package com.wanbo.springbootwx.entity;

import com.thoughtworks.xstream.annotations.XStreamAlias;;

import java.util.Map;

@XStreamAlias("xml")
public class BaseMessage {

    // 发送信息的openid
    @XStreamAlias("ToUserName")
    public String toUserName;

    // 信息来自openid
    @XStreamAlias("FromUserName")
    public String fromUserName;

    // 创建时间
    @XStreamAlias("CreateTime")
    public String createTime;

    //消息类型
    @XStreamAlias("MsgType")
    public String msgType;


    public void setToUserName(String toUserName) {
        this.toUserName = toUserName;
    }

    public void setFromUserName(String fromUserName) {
        this.fromUserName = fromUserName;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public void setMsgType(String msgType) {
        this.msgType = msgType;
    }


    public BaseMessage(Map<String,String> reqMap){
        this.toUserName = reqMap.get("FromUserName");
        this.fromUserName = reqMap.get("ToUserName");
        this.createTime = System.currentTimeMillis()/1000+"";
    }

}

